package com.jic.member.impl;

import com.jic.common.base.orm.Pagination;
import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;
import com.jic.member.mapper.TripExecuteInfoEntityMapper;
import com.jic.member.entity.TripExecuteInfoEntity;
import com.jic.member.service.TripExecuteInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 分支节点执行动作记录表
 * @author : 
 * @email : 
 * @since : 2020-06-08 10:46:07
 * @version : v1.0.0
 */
@Service
public class TripExecuteInfoServiceImpl implements TripExecuteInfoService {

    @Autowired
    private TripExecuteInfoEntityMapper tripExecuteInfoEntityMapper;

    @Override
    public long insert(TripExecuteInfoEntity tripExecuteInfoEntity) {
        long flag = tripExecuteInfoEntityMapper.insert(tripExecuteInfoEntity);
        return flag;
    }

    @Override
    public long delete(Long id) {
        return tripExecuteInfoEntityMapper.delete(id);
    }

    @Override
    public long update(TripExecuteInfoEntity tripExecuteInfoEntity) {
        return tripExecuteInfoEntityMapper.update(tripExecuteInfoEntity);
    }

    @Override
    public TripExecuteInfoEntity queryById(Long id){
        return tripExecuteInfoEntityMapper.queryById(id);
    }

    @Override
    public List<TripExecuteInfoEntity> findAll(TripExecuteInfoEntity tripExecuteInfoEntity){
        return tripExecuteInfoEntityMapper.findAll(tripExecuteInfoEntity);
    }

    @Override
    public PageResult<TripExecuteInfoEntity> queryPage(TripExecuteInfoEntity tripExecuteInfoEntity, Page pageQuery) {
        Pagination pagination = Pagination.build(pageQuery.getStart(), pageQuery.getLimit());
        List<TripExecuteInfoEntity> list = tripExecuteInfoEntityMapper.findOfPage(tripExecuteInfoEntity, pagination);
        long count = tripExecuteInfoEntityMapper.countOfPage(tripExecuteInfoEntity);
        PageResult pageResult = new PageResult();
        pageResult.setRows(list);
        pageResult.setTotal(count);
        return pageResult;
    }
}